#include <iostream>
#include <cstdio>
#include <algorithm>

#define N 10000

using namespace std;

int student[N] = {0};
int prob[N] = {0};
//[student][prob]
int score[N][N] = {0};
int jud[N][N] = {0};

/*int bin_search(int arr[], int size, int target){
	int left, right, mid;
	left = 1;	right = size;
	mid = left + ((right - left) / 2);
	while(left <= right){
		mid = left + ((right - left) / 2);
		if(arr[mid] > target){
			right = mid - 1;
		}
		else if(arr[mid] < target){
			left = mid + 1;
		}
		else{
			return mid;
		}
	}
}
*/
int min(int a, int b){
	if(a <= b)	return a;
	else return b;
}

int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++){
		scanf("%d", &prob[i]);
	}
	sort(prob + 1, prob + n + 1); 
	for(int i = 1; i <= m; i++){
		scanf("%d", &student[i]);
	}
	sort(student + 1, student + m + 1);
	int ta, tb, tc, td, A, H, E;
	cin >> ta >> tb >> tc >> td >> A >> H >> E;
	int R;
	cin >> R;
	int luogu;
	int traditional = 0;
	traditional += ta * n;	//time to load on teeacher's PC(traditional)
	//numbers of judgement
	for(int i = 1; i <= R; i++){
		int pid, sid, scr;
		int ppid, ssid;
		scanf("%d %d %d", &ppid, &ssid, &scr);
		//pid = bin_search(prob, n, ppid);
		pid = lower_bound(prob + 1, prob + n + 1, ppid) - prob;
		//sid = bin_search(student, n, ssid);
		sid = lower_bound(student + 1, student + n + 1, ssid) - student;
		//update Excel
		if(scr > score[sid][pid] &&  E == 1){
			score[sid][pid] = scr;
			traditional += td;
		}
		jud[sid][pid]++;
	}
	//time for judge
	for(int i = 1; i <= m; i++){
		for(int j = 1; j <= n; j++){
			int tea = 0;	int self = ta;
			tea += tb * jud[i][j];
			self += tc * jud[i][j];
			traditional += min(tea, self);
		}
	}
	luogu = (n * ta + R * tc) * 100 / A + H; //time of luogu
	printf("%d\n%d\n", traditional, luogu);
	if(luogu < traditional){
		cout <<"Use Luogu!";
	}
	else{
		cout << "Forget it...";
	}
	return 0;
}
